home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks96
/
RoasterJavaWAHTTPCGI.sit
/
Roaster-Java-WA-HTTP-CGI hack
/
JavaWebStuff
/
RoasterVM.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-22
|
119KB
|
4,299 lines
/* ----------------------------------------------------------------------
* File: RoasterVM.h
* ----------------------------------------------------------------------
* Description:
* Java Runtime Interface for the Roaster™ VM
*
* Written by:
* Mimir Reynisson
*
* History:
* 6/19/96-- Adam - Polished interface to reflect current API.
* 12/14/95-- First release.
* 02/24/96-- Rewrote the interface to conform with the JRI.
*
* © Copyright 1995-96 by Natural Intelligence, Inc. All rights reserved.
* ---------------------------------------------------------------------- */
#ifndef __RoasterVM__
#define __RoasterVM__
#ifdef __cplusplus
extern "C" {
#endif
# ifndef _STDIO
# include <stdio.h>
# endif
# ifndef _STDLIB
# include <stdlib.h>
# endif
# ifndef _STDARG
# include <stdarg.h>
# endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#define ROASTER_MAC
#define JRI_MAJOR_VERSION 1
#define JRI_MINOR_VERSION 0
#define JavaSigBooleanID 'Z'
#define JavaSigByteID 'B'
#define JavaSigCharID 'C'
#define JavaSigShortID 'S'
#define JavaSigIntID 'I'
#define JavaSigLongID 'J'
#define JavaSigFloatID 'F'
#define JavaSigDoubleID 'D'
#define JavaSigVoidID 'V'
#define JavaSigArrayID '['
#define JavaSigParamBeginID '('
#define JavaSigParamEndID ')'
#define JavaSigObjectID 'L'
#define JavaSigBoolean "Z"
#define JavaSigByte "B"
#define JavaSigChar "C"
#define JavaSigShort "S"
#define JavaSigInt "I"
#define JavaSigLong "J"
#define JavaSigFloat "F"
#define JavaSigDouble "D"
#define JavaSigVoid "V"
#define JavaSigArray(T) "[" T
#define JavaSigClass(C) "L" C ";"
#define JavaSigString JavaSigClass("java/lang/String")
#define JavaSigArgs(A) "(" A ")"
#define Package_java_lang "java/lang/"
#define Package_java_io "java/io/"
#define Package_java_net "java/net/"
#define Package_java_util "java/util/"
/*
* The opaque type representing a reference to a Roaster object.
*
* Although Roaster objects are garbage collected, RoasterRefs are given
* out to C programs to prevent the garbage collector from collecting
* a given object. Whenever a native method returns, all references
* allocated but not made global are automatically disposed. Discarding
* RoasterRefs may be done explicitly via the RoasterRef_disposeGlobal
* operation (for global references), and the RoasterEnv_revertToRefFrame
* (for local references)
*/
typedef UInt32 JavaRef;
/*
* The following enum specifies special constant values of type JavaRef
*/
typedef enum JavaRefConstant {
JavaTrue = 1,
JavaFalse = 0,
JavaNull = 0,
JavaClassBoolean = -1,
JavaClassByte = -2,
JavaClassChar = -3,
JavaClassInteger = -4,
JavaClassLong = -5,
JavaClassFloat = -6,
JavaClassDouble = -7,
JavaClassIdent = -8,
JavaClassString = -9,
JavaClassByteArray = -10,
JavaClassObjArray = -11
} JavaRefConstant;
/*
* The following enum specifies the different low-level security
* modes available. Additional security can be implemented in the
* java library itself, and controlled through properties. These
* security modes are largely a concern for environments which
* must execute Java code from unkown sources.
*/
typedef enum JavaSecurityMode {
JavaSecurity_allow_stdout = 0x00000001,
JavaSecurity_allow_stderr = 0x00000002,
JavaSecurity_allow_stdin = 0x00000004,
JavaSecurity_allow_net = 0x00000008,
JavaSecurity_allow_jit = 0x00000010
} JavaSecurityMode;
/*
* This opaque type represents and instance of a Roaster runtime
* environment. The runtime environment contains all classes which
* are loaded and accessible from Java and defines the mapping from
* names to classes. It also contains the heap which contains all
* currently available objects.
*/
typedef struct JavaRuntimeStruct *JavaRuntime;
/* This opaque type represents a point on the stack to which
* control may be returned.
*/
typedef UInt32 JavaCatchFrame;
/*
* This opaque type is used to demarcate groups of references which
* have been returned by the JRI and disposed of together.
*/
typedef UInt32 JavaRefFrame;
/*
* The opaque type representing the Roaster execution environment
* structure. The execution environment defines the context in
* which references may be dereferenced and embodies the execution
* stack of the currently active Java methods.
*/
typedef struct JavaEnvStruct *JavaEnv;
typedef short JavaStatus;
typedef enum JavaStatusCode {
JavaStatusOk = 1,
JavaStatusOutOfMemory = -1,
JavaStatusParamError = -2,
JavaStatusTypeError = -3,
JavaStatusNotFound = -4,
JavaStatusExceptionThrown = -5,
JavaStatusInternalError = -6
} JavaStatusCode;
/*
* The flag values which indicate various access privileges for
* fields, methods, and classes.
*/
typedef enum JavaAccessFlags {
/* Field and Method Access */
JavaAccessMember = 0x0000,
JavaAccessPublic = 0x0001,
JavaAccessProtected = 0x0002,
JavaAccessPrivate = 0x0004,
JavaAccessStatic = 0x0008,
JavaAccessFinal = 0x0010,
JavaAccessSynchronized = 0x0020,
JavaAccessNative = 0x0100,
/* Class Access */
JavaAccessInterface = 0x0200,
JavaAccessAbstract = 0x0400
} JavaAccessFlags;
/*
* This enum specifies the optional interfaces which may be passed
* to the JavaRuntime_supports() operation.
*/
typedef enum JavaSupports {
JavaSupportsCompile,
JavaSupportsEval,
JavaSupportsDebug,
JavaSupportsProfile
} JavaSupports;
#ifdef ROASTER_MAC
#define ROASTER_MSB_ORDER
typedef wide int64;
typedef struct FSSpec *JavaDirSpec;
typedef Boolean Bool;
#elif WIN32
#undef ROASTER_MSB_ORDER
typedef BOOL Bool;
typedef __int64 int64;
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef char *JavaDirSpec;
#endif
typedef char JavaBoolean;
typedef char JavaByte;
typedef UInt16 JavaChar;
typedef short JavaShort;
typedef long JavaInt;
typedef int64 JavaLong;
typedef float JavaFloat;
typedef double JavaDouble;
typedef void *JavaOSThread;
/*
* This type describes the initialization arguments to the
* JavaRuntime_make() routine. The JavaRuntime_make() routine
* is defined this way to allow for future upward compatibility.
*
* The arguments described here represent the 1.0 version (i.e.
* majorVersion == 1, minorVersion == 0).
*
* Fields:
* majorVersion : The major version of the initialization
* arguments to the runtime instance. Major
* versions change when the initialization
* arguments change in an incompatible way.
*
* minorVersion : The minor version of the initialization
* arguments to the runtime instance. Minor
* versions change when the initialization
* arguments change in a compatible way.
*
* initialHeapSize : The size of the initial heap partition to
* allocate.
*
* dynamicHeapChunkSize : The size of each chunk of memory allocated
* to garbage collected objects.
*
* staticHeapChunkSize : The size of each chunk of memory allocated
* to static memory blocks.
*
* maxHeapSize : The maximum heap size which the runtime
* will allow to be allocated. If set to
* JAVA_HEAP_UNLIMITED, the heap will be
* allowed to grow indefinitely, until no
* more memory can be allocated (although
* this is not to say that garbage collection
* wouldn't occur long before memory allocation
* fails).
*
* collectionStartProc : This function is called whenever a garbage
* collection starts. If NULL, no notification
* will be made, but garbage collection will
* still occur.
*
* collectionEndProc : This function is called whenever a garbage
* collection is completed. If NULL, no notication
* will be made.
*
*/
#define JAVA_HEAP_UNLIMITED 0
/*
* Callback: JavaCollectionStartProc
*
* Description:
* The signature of the routine which is called whenever
* garbage collection starts. Applications can use this
* hook to put up a status message or watch cursor.
*
* Parameters:
* runtime : The runtime instance.
*/
typedef void (*JavaCollectionStartProc)(JavaRuntime runtime);
/*
* Callback: JavaCollectionEndProc
*
* Description:
* The signature of the routine which is called whenever
* garbage collection ends. Applications can use this
* hook to put up a status message or remove a watch cursor.
*
* Parameters:
* runtime : The runtime instance.
*/
typedef void (*JavaCollectionEndProc)(JavaRuntime runtime);
/*
* Callback: JavaAllocateProc
*
* Description:
* The signature of the routine which is called whenever
* Roaster needs to allocate memory.
*
* Parameters:
* blockLen : The amount of memory to allocate.
*
* Return value:
* [pointer] : The newly allocate block of memory.
* NULL : Failure to allocate the given block of memory.
*/
typedef void *(*JavaAllocateProc)(size_t blockLen);
/*
* Callback: JavaDisposeProc
*
* Description:
* The signature of the routine which is called whenever
* Roaster needs to dispose memory.
*
* Parameters:
* ptr : The pointer to dispose of.
*/
typedef void (*JavaDisposeProc)(void *ptr);
/*
* Callback: JavaMakeClassLoader
*
* Description:
* .
*/
typedef JavaStatus (*JavaMakeClassLoader)(JavaRuntime runtime, void *args, void **storage);
/*
* Callback: JavaDisposeClassLoader
*
* Description:
* .
*/
typedef JavaStatus (*JavaDisposeClassLoader)(JavaRuntime runtime, void **storage);
/*
* Callback: JavaLoadClassProc
*
* Description:
* .
*
* Parameters:
*/
typedef JavaStatus (*JavaLoadClassProc)(JavaRuntime runtime,
char *className, JavaRef *classRef, void **storage, Bool resolve);
/*
* Callback: JavaExitHandlerProc
*
* Description:
* .
*
* Parameters:
*/
typedef JavaStatus (*JavaExitHandlerProc)(JavaRuntime runtime, void *exitData);
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
typedef struct JavaRuntimeInitargs {
short majorVersion;
short minorVersion;
size_t initialHeapSize;
size_t dynamicHeapChunkSize;
size_t staticHeapChunkSize;
size_t maxHeapSize;
JavaCollectionStartProc collectionStartProc;
JavaCollectionEndProc collectionEndProc;
/* Roaster specific fields */
JavaAllocateProc heapAllocationProc;
JavaDisposeProc heapDisposeProc;
JavaAllocateProc gcHeapAllocationProc;
JavaDisposeProc gcHeapDisposeProc;
OSType outputFileCreator;
OSType outputFileType;
JavaDirSpec homeDirectory;
JavaDirSpec javaDirectory;
} JavaRuntimeInitargs;
#define JavaRuntimeStatusStructVersion 1
typedef struct JavaRuntimeStatusStruct {
size_t statusVersion;
size_t dynamicHeapAllocated;
size_t staticHeapAllocated;
size_t dynamicHeapUsed;
size_t staticHeapUsed;
size_t numberOfClasses;
size_t memoryUsedByClasses;
size_t numberOfObjects;
size_t memoryUsedByObjects;
size_t numberOfArrays;
size_t memoryUsedByArrays;
size_t methodHashMiss;
size_t methodHashHit;
size_t fieldHashMiss;
size_t fieldHashHit;
size_t numberOfThreads;
size_t numberOfClientConnections;
size_t numberOfServerConnections;
} *JavaRuntimeStatus;
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
/*
* Function: JavaRuntime_makeDefaultInitArgs
*
* Description:
* Initializes an initialization arguments block.
*
* Parameters:
* initargs : § The initialization to initialize.
*/
void
JavaRuntime_makeDefaultInitArgs(JavaRuntimeInitargs *initargs);
/*
* Function: JavaRuntime_make
*
* Description:
* Initializes and returns a new Roaster runtime instance.
* If a new runtime instance cannot be constructed (either
* because of limited resources or incompatible initialization
* arguments) NULL is returned.
*
* This routine is defined in terms of an initialization
* arguments structure in order to allow for future upward
* compatibility.
*
* Parameters:
* initargs : The initialization arguments for a
* new runtime instance.
*
* Return value:
* [pointer] : The newly created runtime instance.
* NULL : The runtime instance failed to be allocated.
*/
JavaStatus
JavaRuntime_make(JavaRuntimeInitargs *initargs, JavaRuntime *outRuntime);
/*
* Function: JavaRuntime_status
*
* Description: Returns a filled-in status structure.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_status(JavaRuntime runtime, JavaRuntimeStatus status);
/*
* Function: JavaRuntime_connectDebugger
*
* Description: Connect a debugger to the runtime interface.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_connectDebugger(JavaRuntime runtime, JavaDirSpec launchSpec);
/*
* Function: JavaRuntime_debuggerConnected
*
* Description: Verifies if a debugger is connected to the runtime.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_debuggerConnected(JavaRuntime runtime);
/*
* Function: JavaRuntime_pushClassLoader
*
* Description: Pushes a new classloader onto the stack of loaders.
* The runtime uses loaders from top to bottom in the stack
* to resolve a class.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_pushClassLoader(JavaRuntime runtime,
JavaMakeClassLoader make, JavaDisposeClassLoader dispose,
JavaLoadClassProc loadClass, void *initArgs);
/*
* Function: JavaRuntime_pushClassFileLoader
*
* Description: Pushes a loader for classfiles onto the runtime stack.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_pushClassFileLoader(JavaRuntime runtime, JavaDirSpec homeDir);
/*
* Function: JavaRuntime_pushZipClassLoader
*
* Description: Pushes a loader for Zip files onto the runtime stack.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_pushZipClassLoader(JavaRuntime runtime, JavaDirSpec zipFile);
/*
* Function: JavaRuntime_pushExitHandler
*
* Description: Installs a callback for when the runtime exits.
*
* Parameters:
* runtime : The runtime instance.
*/
JavaStatus
JavaRuntime_pushExitHandler(JavaRuntime runtime,
JavaExitHandlerProc exitHandler, void *exitData);
/*
* Function: JavaRuntime_dispose
*
* Description:
* Disposes a Java runtime instance. This cleanly shuts down
* the Java runtime, freeing all resources associated with it.
* After disposing a runtime, all operations associated with
* execution environments constructed from that runtime, and
* all references associated with those execution environments
* becomes undefined.
*
* IMPORTANT:
* After disposing a runtime instance, all references to that
* instance become invalid and should not be used.
*
* Parameters:
* runtime : The runtime instance.
*/
void
JavaRuntime_dispose(JavaRuntime runtime);
/*
* Function: JavaRuntime_exitInternal
*
* Description:
* Calls Runtime.exitInternal() from Java, which can be overridden.
* The default implementation is to quit the application. This has
* the effect of terminating the running applet or Java app.
*
* Parameters:
* runtime : The runtime instance.
*
* exitCode : The exit code returned to the OS on some platforms.
*/
JavaStatus
JavaRuntime_exitInternal(JavaRuntime runtime, JavaInt exitCode);
/*
* Function: JavaRuntime_getHomeDirectory
*
* Description:
* Gets the directory where the applet was run from.
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [pointer] : .
*/
JavaDirSpec
JavaRuntime_getHomeDirectory(JavaRuntime runtime);
/*
* Function: JavaRuntime_getJavaDirectory
*
* Description:
* Gets the directory where the JDK is installed.
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [pointer] : .
*/
JavaDirSpec
JavaRuntime_getJavaDirectory(JavaRuntime runtime);
/*
* Function: JavaRuntime_setHomeDirectory
*
* Description:
* Sets the running applet's root directory.
*
* Parameters:
* runtime : The runtime instance.
*
* homeDir : The new home directory.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : .
*/
JavaStatus
JavaRuntime_setHomeDirectory(JavaRuntime runtime, JavaDirSpec homeDir);
/*
* Function: JavaRuntime_setJavaDirectory
*
* Description:
* Sets the main search path directory for classfiles.
*
* Parameters:
* runtime : The runtime instance.
*
* homeDir : The new home directory.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : .
*/
JavaStatus
JavaRuntime_setJavaDirectory(JavaRuntime runtime, JavaDirSpec homeDir);
/*
* Function: JavaRuntime_getOutputFileCreator
*
* Description:
* Returns the MacOS file creator type (i.e. 'APPL').
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [OSType] : .
*/
OSType
JavaRuntime_getOutputFileCreator(JavaRuntime runtime);
/*
* Function: JavaRuntime_getOutputFileType
*
* Description:
* Returns the MacOS file type (i.e. 'TEXT').
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [OSType] : .
*/
OSType
JavaRuntime_getOutputFileType(JavaRuntime runtime);
/*
* Function: JavaRuntime_setOutputFileCreator
*
* Description:
* Sets the MacOS file creator resource.
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [OSType] : .
*/
JavaStatus
JavaRuntime_setOutputFileCreator(JavaRuntime runtime, OSType newCreator);
/*
* Function: JavaRuntime_setOutputFileType
*
* Description:
* Sets the MacOS file type resource.
*
* Parameters:
* runtime : The runtime instance.
*
* Return value:
* [OSType] : .
*/
JavaStatus
JavaRuntime_setOutputFileType(JavaRuntime runtime, OSType newType);
/*
* Function: JavaRuntime_supports
*
* Description:
* Tests whether a Java runtime implements an optional portion
* of the Java interface.
*
* Parameters:
* runtime : The runtime instance.
*
* optionalAPI : The optional interface to test.
*/
JavaStatus
JavaRuntime_supports(JavaRuntime runtime, JavaSupports optionalAPI);
/*
* Function: JavaRuntime_getProperty
*
* Description:
* Retrieves a Java runtime property value. This may be
* particularly useful to retrieve the vendor or version
* of the Java runtime environment.
*
* Parameters:
* runtime : The runtime instance.
*
* propName : The name of the property to get. The name is
* specified as a NULL-terminated UTF string.
*
* result : § The resulting property value. It is the
* caller's responsibility to dispose this string.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired property was not found.
* JavaStatusOutOfMemory : The property could not be allocated.
*/
JavaStatus
JavaRuntime_getProperty(JavaRuntime runtime, char *propName, char **result);
/*
* Function: JavaRuntime_setProperty
*
* Description:
* Sets a Java runtime property value.
*
* Parameters:
* runtime : The runtime instance.
*
* propName : The name of the property to set. The name is
* specified as a NULL-terminated UTF string.
*
* value : The value to which the property is to be set.
* The Java runtime will __COPY__ this string into
* it's own heap.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusOutOfMemory : The property could not be allocated.
*/
JavaStatus
JavaRuntime_setProperty(JavaRuntime runtime, char *propName, char *value);
/*
* Callback: JavaMethodProc
*
* Description:
* The signature of a native method.
*
* Note that the current method name, signature, and method
* data can be retrieved from the execution environment via
* JavaEnv_getCurrentMethodInfo().
*
* Parameters:
* env : The execution environment.
*/
typedef JavaStatus
(*JavaMethodProc)(JavaEnv env);
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
typedef struct JavaNativeTableStruct {
char *className;
char *methodName;
char *methodSignature;
JavaMethodProc methodProc;
void *methodData;
JavaAccessFlags methodAccess;
} JavaNativeTable;
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
/*
* Function: JavaRuntime_setMethod
*
* Description:
* Unlike the JDK which relies on a dynamic linker to find
* native methods based on a naming convention, Roaster requries
* that native methods be explicitly registered. This eliminates
* the need for a dynamic linker, and also allows the signature
* of the method to play a role in the lookup process when the
* runtime invokes a native method.
*
* Parameters:
* runtime : The runtime instance.
*
* class : The class on which the method is to be registered.
*
* methodName : The name of the method to register. The name must
* be a NULL-terminated UTF string.
*
* methodSig : The signature of the method to register. The name
* must be a NULL-terminated UTF string.
*
* methodProc : A pointer to the native routine that implements
* the method. Setting the methodProc to NULL has the
* effect of unregistering any method with the specified
* name and signature. Setting the method when there is
* already a method registered has the effect of replacing
* the current method.
*
* methodData : A pointer to an arbitrary piece of storage. This
* data will be passed to the methodProc each time
* it is called and may be used to store data which
* must persist between invocations of the method.
* If not needed, the method data may be NULL. Setting
* the method data when there is already data registered
* with a method has the effect of replacing the method
* data, so care must be taken to retrieve the current
* method data (via JavaRuntime_getMethod) and dispose
* of it properly before replacing the method data or a
* leak may result.
*
* isStatic : A boolean specifying whether this method is a static
* (i.e. class) method, or instance method. TRUE specifies
* that the method is static.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusOutOfMemory : The method could not be registered because
* memory could not be allocated.
*/
JavaStatus
JavaRuntime_setMethod(JavaRuntime runtime, JavaRef classRef,
char *methodName, char *methodSig, JavaMethodProc methodProc,
void *methodData, Bool isStatic);
/*
* Function: JavaRuntime_getMethod
*
* Description:
* Retrieves a native method from a runtime instance. This
* may be useful if the currently registered method is to be
* wrapped in some outer procedure.
*
* Parameters:
* runtime : The runtime instance.
*
* class : The class on which the method is to be registered.
*
* methodName : The name of the method to register. The name must
* be a NULL-terminated UTF string.
*
* methodSig : The signature of the method to register. The name
* must be a NULL-terminated UTF string.
*
* methodProc : § The resulting pointer to the native routine that
* implements the method. Specifying a NULL pointer
* indicates that the result is not desired.
*
* methodData : § The resulting pointer to the arbitrary piece of
* storage which was originally associated with the
* given native method using JavaRuntime_setMethod().
* Specifying a NULL pointer indicates that the result
* is not desired.
*
* isStatic : § A resulting boolean indicating whether this
* method is a static (class) method, or instance
* method. TRUE specifies that the method is static.
* Specifying a NULL pointer indicates that the result
* is not desired.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The method with the specified name and signature
* could not be found in the runtime instance.
*/
JavaStatus
JavaRuntime_getMethod(JavaRuntime runtime, JavaRef classRef,
char *methodName, char *methodSig, JavaMethodProc *methodProc,
void **methodData, Bool *isStatic);
/*
* Function: JavaRuntime_registerNativeMethodTable
*
* Description:
* Registers all the native methods in the specified
* method table. The method table must include a NULL
* terminated entry to signify the end of the table.
*
* Parameters:
* runtime : The runtime instance.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The method with the specified name and signature
* could not be found in the runtime instance.
*/
JavaStatus
JavaRuntime_registerNativeMethodTable(JavaRuntime runtime, JavaNativeTable *methodTable);
/*
* Function: JavaRuntime_getClassNameFromFile
*
* Description:
* Gets the name of the class contained in the specified file.
*
* Parameters:
* runtime : The runtime instance.
*
* file : The class file.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusOutOfMemory : The class data could not be allocated.
*/
JavaStatus
JavaRuntime_getClassNameFromFile(JavaRuntime runtime,
JavaDirSpec file, char *buffer, size_t length);
/*
* Function: JavaRuntime_getClassNameFromData
*
* Description:
* Gets the name of the class contained in the specified buffer.
*
* Parameters:
* runtime : The runtime instance.
*
* file : The class file.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusOutOfMemory : The class data could not be allocated.
*/
JavaStatus
JavaRuntime_getClassNameFromData(JavaRuntime runtime,
char *data, size_t dataLength, char *buffer, size_t length);
/*
* Function: JavaRuntime_loadClass
*
* Description:
* Loads a class from flattened class data.
*
* Parameters:
* runtime : The runtime instance.
*
* result : § The resulting class object which was loaded.
*
* data : The flattened class data.
*
* dataLength : The number of bytes in the class data.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired class object could not be
* loaded from the data.
*/
JavaStatus
JavaRuntime_loadClass(JavaRuntime runtime, JavaRef *result,
char *data, size_t dataLength, Bool resolveClass);
/*
* Function: JavaRuntime_unloadClass
*
* Description:
* Unloads a class from the environment. After unloading,
* the class may be garbage collected (provided there are
* no other references to it), and JavaRuntime_findClass()
* will return JavaStatusNotFound.
*
* Parameters:
* runtime : The runtime instance.
*
* classRef : The class to unload.
*
* Return status:
* JavaTrue : Operation completed normally.
* JavaFalse : The class could not be unloaded (perhaps
* because it is a system or built-in class).
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a valid
* class object.
*/
JavaStatus
JavaRuntime_unloadClass(JavaRuntime runtime, JavaRef classRef);
/*
* Function: JavaRuntime_findClass
*
* Description:
* Looks up a class given a name in the runtime and returns
* a reference to it.
*
* Parameters:
* runtime : The runtime instance.
*
* result : § The resulting class object which was found
* An actual reference to a class object may be
* returned, or one of the special JavaRefConstant
* values.
*
* name : The name of the class object to look up. The
* name is specified as a NULL-terminated UTF
* string.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired class object was not found.
*/
JavaStatus
JavaRuntime_findClass(JavaRuntime runtime, JavaRef *result, char *name);
/*
* Function: JavaRuntime_findClassUnresolved
*
* Description:
* Looks up a class given a name in the runtime and returns
* a reference to it. The class is not resolved (i.e. the
* superclass is not verified, etc.). Essentially a quicker
* variant of JavaRuntime_findClass(). The class is always
* resolved when it is first used.
*
* Parameters:
* runtime : The runtime instance.
*
* result : § The resulting class object which was found
* An actual reference to a class object may be
* returned, or one of the special JavaRefConstant
* values.
*
* name : The name of the class object to look up. The
* name is specified as a NULL-terminated UTF
* string.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired class object was not found.
*/
JavaStatus
JavaRuntime_findClassUnresolved(JavaRuntime runtime, JavaRef *result, char *name);
/*
* Function: JavaRuntime_yield
*
* Description:
* Yields to the main event loop.
*
* Parameters:
* delay : .
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired class object was not found.
*/
JavaStatus
JavaRuntime_yield(JavaInt delay);
/*
* Function: JavaRuntime_yieldLong
*
* Description:
* Yields to the main event loop with a longer possible delay
* than JavaRuntime_yield().
*
* Parameters:
* delay : .
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired class object was not found.
*/
JavaStatus
JavaRuntime_yieldLong(JavaLong delay);
/*
* Function: JavaRuntime_setLowBreakPoint
*
* Description:
*
* Parameters:
* delay : .
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The desired class object was not found.
*/
JavaStatus
JavaRuntime_setLowBreakPoint(JavaRuntime runtime, char *className, size_t offset);
/*
* Function: JavaRuntime_getClassList
*
* Description:
* Returns the current list of loaded classes.
*
* Parameters:
* runtime : The runtime instance.
*
* Return status:
*/
JavaRef
JavaRuntime_getClassList(JavaRuntime runtime);
/*
* Function: JavaRuntime_getNextClass
*
* Description:
* Given a class reference, the function returns a new reference
* to the next class in the current list of loaded classes.
*
* Parameters:
* runtime : The runtime instance.
*
* classRef : The class reference.
*
* Return status:
*/
JavaRef
JavaRuntime_getNextClass(JavaRuntime runtime, JavaRef classRef);
/*
* Function: JavaEnv_make
*
* Description:
* Constructs a new Java execution environment.
*
* Parameters:
* runtime : The runtime instance with which this
* environment is to be associated. The
* runtime defines the classes that will
* be accessible from the environment.
*
* thread : The platform thread upon which Java
* evaluation occurs. If NULL, the current
* thread is used.
*
* Return value:
* [pointer] : The newly created execution environment.
* NULL : The execution environment failed to be
* allocated.
*/
JavaEnv
JavaEnv_make(JavaRuntime runtime, JavaOSThread thread);
/*
* Function: JavaEnv_dispose
*
* Description:
* Disposes a Java execution environment.
*
* Parameters:
* env : The execution environment.
*/
void
JavaEnv_dispose(JavaEnv env);
/*
* Function: JavaEnv_getRuntime
*
* Description:
* Returns the runtime instance of an execution
* environment.
*
* Parameters:
* env : The execution environment.
*
* Return value:
* [pointer] : The runtime instance.
*/
JavaRuntime
JavaEnv_getRuntime(JavaEnv env);
/*
* Function: JavaEnv_getSecurityMode
*
* Description:
* Returns the security mode for an execution
* environment.
*
* Parameters:
* env : The execution environment.
*
* Return value:
*/
JavaSecurityMode
JavaEnv_getSecurityMode(JavaEnv env);
/*
* Function: JavaEnv_setSecurityMode
*
* Description:
* Sets the security mode for an execution
* environment.
*
* Parameters:
* env : The execution environment.
*
* Return value:
*/
JavaStatus
JavaEnv_setSecurityMode(JavaEnv env, JavaSecurityMode newMode);
/*
* Function: JavaEnv_getThread
*
* Description:
* Returns the native thread of an execution
* environment.
*
* Parameters:
* env : The execution environment.
*
* Return value:
* [pointer] : The native thread.
*/
JavaOSThread
JavaEnv_getThread(JavaEnv env);
/*
* Function: JavaEnv_getCurrentMethodInfo
*
* Description:
* Returns information about the current native
* method invocation and its execution environment.
*
* Parameters:
* env : The execution environment.
*
* methodClass : § The returned class on which the current
* method is defined. Specifying a NULL
* pointer indicates that the result is
* not desired.
*
* methodName : § The returned name of the current method.
* The name is an identifier. Specifying a NULL
* pointer indicates that the result is not
* desired.
*
* methodSig : § The returned signature of the current
* method. The signature is an identifier.
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* methodData : § The returned method data which was registered
* with the method by JavaRuntime_setMethod()..
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusNotFound : The Java runtime is not currently in the
* process of invoking a native method.
*/
JavaStatus
JavaEnv_getCurrentMethodInfo(JavaEnv env, JavaRef *methodClass,
JavaRef *methodName, JavaRef *methodSig, void **methodData);
/*
* Function: JavaEnv_throw
*
* Description:
* Causes an exception to be thrown.
*
* Parameters:
* env : The execution environment.
*
* exceptionRef : The exception reference to throw, must be a
* subclass of java.lang.Throwable.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter was not a valid class
* object or subclass of java.lang.Throwable.
* JavaStatusExceptionThrow : Some other exception was thrown by Java
* in the course of trying to throw this one.
*/
JavaStatus
JavaEnv_throw(JavaEnv env, JavaRef exceptionRef);
/*
* Function: JavaEnv_throwNew
*
* Description:
* This convenience routine causes an exception to be
* constructed and thrown. The message string is included
* as the message field of the newly constructed exception.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class of exception to throw, must be a
* subclass of java.lang.Throwable.
*
* message : A NULL-terminated UTF string specifying any
* error message to report. The string is copied
* by the routine and must be freed by the caller.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter was not a valid class
* object or subclass of java.lang.Throwable.
* JavaStatusExceptionThrow : Some other exception was thrown by Java
* in the course of trying to throw this one.
*/
JavaStatus
JavaEnv_throwNew(JavaEnv env, char *className, char *message);
/*
* Function: JavaEnv_exceptionOccurred
*
* Description:
* Returns the current exception object if one was thrown.
* Actually returns the last thrown object, exception,
* error, throwable, or otherwise.
*
* Parameters:
* env : The execution environment.
*
* Return status:
* [reference] : An exception occurred and was returned as
* the result of the routine.
* JavaNull : There was no current exception thrown.
*/
JavaRef
JavaEnv_exceptionOccurred(JavaEnv env);
/*
* Function: JavaEnv_exceptionDescribe
*
* Description:
* Describes the exception which has occurred. If no
* exception occurred, this operation prints nothing.
*
* Parameters:
* env : The execution environment.
*
* out : The file pointer to which the exception
* information is to be printed.
*/
void
JavaEnv_exceptionDescribe(JavaEnv env, FILE *out);
/*
* Function: JavaEnv_exceptionClear
*
* Description:
* Clears the current exception. This causes the
* environment to act as if the exception has been
* caught and allows subsequent evaluation to proceed
* normally. This operation is primarily used in
* conjunction with JavaEnv_revertToCatchFrame() to
* handle exceptions from native code.
*
* Parameters:
* env : The execution environment.
*/
void
JavaEnv_exceptionClear(JavaEnv env);
/*
* Function: JavaEnv_establishRefFrame
*
* Description:
* Creates a reference frame on the reference stack
* and returns it. Establishing a reference frame
* demarcates all subsequent references that will be
* returned by JRI calls and allows them to be disposed
* as a group (by calling JavaEnv_revertToRefFrame()).
*
* Note that this operation is called automatically by
* the runtime before entering a native method.
*
* Parameters:
* env : The execution environment.
*
* Return value:
* [reference] : The reference frame.
*/
JavaRefFrame
JavaEnv_establishRefFrame(JavaEnv env);
/*
* Function: JavaEnv_revertToRefFrame
*
* Description:
* Reverts the reference stack to a previously established
* reference frame. This allows all references allocated
* since the reference frame was established to be disposed
* as a group. Only references that are made global (by
* calling JavaRef_makeGlobal()) will persist after calling
* JavaEnv_revertToRefFrame().
*
* Note that this operation is called automatically by
* the runtime after exiting a native method.
*
* Parameters:
* env : The execution environment.
*
* refFrame : The reference frame to which to revert.
*
* Return value:
* JavaTrue : The operation completed normally.
* JavaFalse : An invalid reference frame was specified,
* presumably one which has already been
* popped.
*/
JavaStatus
JavaEnv_revertToRefFrame(JavaEnv env, JavaRefFrame refFrame);
/*
* Function: JavaEnv_pushBoolean
* JavaEnv_pushByte
* JavaEnv_pushChar
* JavaEnv_pushShort
* JavaEnv_pushInt
* JavaEnv_pushLong
* JavaEnv_pushFloat
* JavaEnv_pushDouble
* JavaEnv_pushRef
*
* Description: Pushes a Java variable of the appropriate type onto the
* current execution stack.
*
* Parameters:
* env : The execution environment.
*
* value : The value to push.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : .
*/
JavaStatus
JavaEnv_pushBoolean(JavaEnv env, JavaBoolean value);
JavaStatus
JavaEnv_pushByte(JavaEnv env, JavaByte value);
JavaStatus
JavaEnv_pushChar(JavaEnv env, JavaChar value);
JavaStatus
JavaEnv_pushShort(JavaEnv env, JavaShort value);
JavaStatus
JavaEnv_pushInt(JavaEnv env, JavaInt value);
JavaStatus
JavaEnv_pushLong(JavaEnv env, JavaLong value);
JavaStatus
JavaEnv_pushFloat(JavaEnv env, JavaFloat value);
JavaStatus
JavaEnv_pushDouble(JavaEnv env, JavaDouble value);
JavaStatus
JavaEnv_pushRef(JavaEnv env, JavaRef ref);
/*
* Function: JavaEnv_popBoolean
* JavaEnv_popByte
* JavaEnv_popChar
* JavaEnv_popShort
* JavaEnv_popInt
* JavaEnv_popLong
* JavaEnv_popFloat
* JavaEnv_popDouble
* JavaEnv_popRef
*
* Description: Pops a Java variable of the appropriate type off the
* current execution stack.
*
* Parameters:
* env : The execution environment.
*
* Return value:
*/
JavaBoolean
JavaEnv_popBoolean(JavaEnv env);
JavaByte
JavaEnv_popByte(JavaEnv env);
JavaChar
JavaEnv_popChar(JavaEnv env);
JavaShort
JavaEnv_popShort(JavaEnv env);
JavaInt
JavaEnv_popInt(JavaEnv env);
JavaLong
JavaEnv_popLong(JavaEnv env);
JavaFloat
JavaEnv_popFloat(JavaEnv env);
JavaDouble
JavaEnv_popDouble(JavaEnv env);
JavaRef
JavaEnv_popRef(JavaEnv env);
/*
* Function: JavaRef_makeLocal
*
* Description:
* Creates a new local Java reference that refers to
* the object referred to by the ref parameter. Local
* references are automatically disposed when the
* native method that created them returns, or may be
* disposed explicitly by calling JavaEnv_revertToRefFrame().
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to duplicate.
*
* Return value:
* [reference] : The new local reference which refers to the
* original object, ref.
* JavaNull : The local reference could not be allocated.
*/
JavaRef
JavaRef_makeLocal(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_makeGlobal
*
* Description:
* Creates a new global Java reference that refers to
* the object referred to by the ref parameter. Global
* references must be explicitly disposed by calling
* JavaRef_disposeGlobal().
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to duplicate.
*
* Return value:
* [reference] : The new global reference which refers to the
* original object, ref.
* JavaNull : The global reference could not be allocated.
*/
JavaRef
JavaRef_makeGlobal(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_disposeGlobal
*
* Description:
* Disposes a Java reference. This has the effect of
* marking object as no longer referenced from the C world
* and does NOT destroy the object directly (i.e. garbage
* collect and/or finalize it).
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to dispose.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The ref parameter did not specify a valid
* global reference, or was a local rather
* then global reference.
*/
JavaStatus
JavaRef_disposeGlobal(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_isGlobal
*
* Description:
* Determines whether a reference is a global reference.
*
* Parameters:
* env : The execution environment.
*
* ref : The reference.
*
* Return status:
* JavaTrue : Reference is a global reference.
* JavaFalse : Reference is a local reference.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaRef_isGlobal(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_assign
*
* Description:
* Assigns one Java reference to refer to the same
* object as another.
*
* Parameters:
* env : The execution environment.
*
* dest : The reference to have its value assigned.
* release the object that this reference
* currently refers to and cause it to refer
* to the object from the src parameter. The
* dest reference remains global if it was
* global, and remains local if it was local
* before this routine was called.
*
* src : The reference to assign the value from.
* The object referred to by this reference
* will be assigned to the dest parameter.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaRef_assign(JavaEnv env, JavaRef dest, JavaRef src);
/*
* Function: JavaRef_isSameObject
*
* Description:
* Compares the identity of two Java objects.
*
* Parameters:
* env : The execution environment.
*
* r1 : A reference to test.
*
* r2 : The other reference to test.
*
* Return status:
* JavaTrue : The references referred to the same object.
* JavaFalse : The references didn't refer to the same object.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaRef_isSameObject(JavaEnv env, JavaRef dest, JavaRef src);
/*
* Function: JavaRef_isArray
*
* Description:
* Used to tell if a specified reference points to an
* array object.
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to test.
*
* Return value:
* JavaTrue : The reference is to an array object.
* JavaFalse : The reference points to something else.
*/
JavaStatus
JavaRef_isArray(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_isObject
*
* Description:
* Used to tell if a specified reference points to an
* object.
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to test.
*
* Return value:
* JavaTrue : The reference is to an object.
* JavaFalse : The reference points to something else.
*/
JavaStatus
JavaRef_isObject(JavaEnv env, JavaRef ref);
/*
* Function: JavaRef_isClass
*
* Description:
* Used to tell if a specified reference points to a
* class object.
*
* Parameters:
* env : The execution environment.
*
* ref : The reference to test.
*
* Return value:
* JavaTrue : The reference is to a class object.
* JavaFalse : The reference points to something else.
*/
JavaStatus
JavaRef_isClass(JavaEnv env, JavaRef ref);
/*
* Function: JavaObject_make
*
* Description:
* Constructs a new Java object, returning a reference
* to it. References to objects may be disposed via the
* JavaRef_disposeGlobal() operation although this does
* not destroy the object directly but rather allows them
* to be garbage collected.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed object. Specifying a
* NULL pointer indicates that the result is not
* desired.
*
* classRef : The class object which defines the static
* method. Class objects may be obtained by
* the JavaRuntime_findClass() operation.
*
* constructorSig : The signature of the constructor method to
* invoke. The signature is used to determine
* the number and type of any optional parameters
* which follow it.
*
* ... : Any other parameters to be passed to the
* method according to its signature.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaObject_make(JavaEnv env, JavaRef *result,
JavaRef classRef, char *constructorSig, ...);
JavaStatus
JavaObject_makeUTF(JavaEnv env, JavaRef *result,
char *className, char *constructorSig, ...);
/*
* Function: JavaArray_make
*
* Description:
* Constructs a new Java array, returning a reference
* to it. References to arrays may be disposed via the
* JavaRef_disposeGlobal() operation although this does
* not destroy the object directly but rather allows them
* to be garbage collected.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed object. Specifying a
* NULL pointer indicates that the result is not
* desired.
*
* classRef : The class object which defines the static
* method. Class objects may be obtained by
* the JavaRuntime_findClass() operation.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaArray_make(JavaEnv env, JavaRef *result,
JavaRef classRef, long length);
/*
* Function: JavaArray_makeUTF
*
* Description:
* Identical to JavaArray_make except it takes an array of characters
* and converts them to an array of Unicode (UTF) characters on the
* runtime side.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed array. Specifying a
* NULL pointer indicates that the result is not
* desired.
*
* className : String name of the class object that holds the static method.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaArray_makeUTF(JavaEnv env, JavaRef *result,
char *className, long length);
/*
* Function: JavaObject_getClass
*
* Description:
* Returns the class of an object.
*
* Parameters:
* env : The execution environment.
*
* obj : The object which class should be returned.
*
* Return status:
* [reference] : The class of the object.
* JavaNull : The class could not be returned (presumably
* because the reference was invalid or null).
*/
JavaRef
JavaObject_getClass(JavaEnv env, JavaRef obj);
/*
* Function: JavaObject_print
*
* Description:
* Prints an object to an output file pointer. The
* printed representation is not necessarily rereadable
* by Java, but may be displayed to users to give some
* indication of which object is in question.
*
* Parameters:
* env : The execution environment.
*
* obj : The object to print.
*
* out : The file pointer to which to print.
*/
void
JavaObject_print(JavaEnv env, JavaRef obj, FILE *out);
/*
* Function: JavaObject_getFieldByName
*
* Description:
* Accesses a field of an object using an UTF string
* for the field's name.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* fieldName : A NULL-terminated UTF string specifying
* the name of the field.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
*/
JavaStatus
JavaObject_getFieldByName(JavaEnv env, JavaRef obj,
char *fieldName, JavaRef *result);
/*
* Function: JavaObject_setFieldByName
*
* Description:
* Set a field of an object using a UTF string for
* the field's name.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* fieldName : A NULL-terminated UTF string specifying
* the name of the field.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaObject_setFieldByName(JavaEnv env, JavaRef obj,
char *fieldName, JavaRef value);
/*
* Function: JavaObject_getField
*
* Description:
* Accesses a field of an object by index.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
*/
JavaStatus
JavaObject_getField(JavaEnv env, JavaRef obj,
size_t index, JavaRef *result);
/*
* Function: JavaObject_setField
*
* Description:
* Sets a field of an object by index.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaObject_setField(JavaEnv env, JavaRef obj,
size_t index, JavaRef value);
/*
* Function: JavaObject_getField_boolean
* JavaObject_getField_byte
* JavaObject_getField_char
* JavaObject_getField_short
* JavaObject_getField_int
* JavaObject_getField_long
* JavaObject_getField_float
* JavaObject_getField_double
*
* Description:
* Accesses a field of an object by index.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
*/
JavaStatus
JavaObject_getField_boolean(JavaEnv env, JavaRef obj,
size_t index, JavaBoolean *result);
JavaStatus
JavaObject_getField_byte(JavaEnv env, JavaRef obj,
size_t index, JavaByte *result);
JavaStatus
JavaObject_getField_char(JavaEnv env, JavaRef obj,
size_t index, JavaChar *result);
JavaStatus
JavaObject_getField_short(JavaEnv env, JavaRef obj,
size_t index, JavaShort *result);
JavaStatus
JavaObject_getField_int(JavaEnv env, JavaRef obj,
size_t index, JavaInt *result);
JavaStatus
JavaObject_getField_long(JavaEnv env, JavaRef obj,
size_t index, JavaLong *result);
JavaStatus
JavaObject_getField_float(JavaEnv env, JavaRef obj,
size_t index, JavaFloat *result);
JavaStatus
JavaObject_getField_double(JavaEnv env, JavaRef obj,
size_t index, JavaDouble *result);
/*
* Function: JavaObject_getFieldByName_boolean
* JavaObject_getFieldByName_byte
* JavaObject_getFieldByName_char
* JavaObject_getFieldByName_short
* JavaObject_getFieldByName_int
* JavaObject_getFieldByName_long
* JavaObject_getFieldByName_float
* JavaObject_getFieldByName_double
*
* Description:
* Accesses a field of an object by name.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The field was not of appropriate type.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
*/
JavaStatus
JavaObject_getFieldByName_boolean(JavaEnv env, JavaRef obj,
char *fieldName, JavaBoolean *result);
JavaStatus
JavaObject_getFieldByName_byte(JavaEnv env, JavaRef obj,
char *fieldName, JavaByte *result);
JavaStatus
JavaObject_getFieldByName_char(JavaEnv env, JavaRef obj,
char *fieldName, JavaChar *result);
JavaStatus
JavaObject_getFieldByName_short(JavaEnv env, JavaRef obj,
char *fieldName, JavaShort *result);
JavaStatus
JavaObject_getFieldByName_int(JavaEnv env, JavaRef obj,
char *fieldName, JavaInt *result);
JavaStatus
JavaObject_getFieldByName_long(JavaEnv env, JavaRef obj,
char *fieldName, JavaLong *result);
JavaStatus
JavaObject_getFieldByName_float(JavaEnv env, JavaRef obj,
char *fieldName, JavaFloat *result);
JavaStatus
JavaObject_getFieldByName_double(JavaEnv env, JavaRef obj,
char *fieldName, JavaDouble *result);
/*
* Function: JavaObject_setField_boolean
* JavaObject_setField_byte
* JavaObject_setField_char
* JavaObject_setField_short
* JavaObject_setField_int
* JavaObject_setField_long
* JavaObject_setField_float
* JavaObject_setField_double
*
* Description:
* Sets a field of an object by index.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaObject_setField_boolean(JavaEnv env, JavaRef obj,
size_t index, JavaBoolean value);
JavaStatus
JavaObject_setField_byte(JavaEnv env, JavaRef obj,
size_t index, JavaByte value);
JavaStatus
JavaObject_setField_char(JavaEnv env, JavaRef obj,
size_t index, JavaChar value);
JavaStatus
JavaObject_setField_short(JavaEnv env, JavaRef obj,
size_t index, JavaShort value);
JavaStatus
JavaObject_setField_int(JavaEnv env, JavaRef obj,
size_t index, JavaInt value);
JavaStatus
JavaObject_setField_long(JavaEnv env, JavaRef obj,
size_t index, JavaLong value);
JavaStatus
JavaObject_setField_float(JavaEnv env, JavaRef obj,
size_t index, JavaFloat value);
JavaStatus
JavaObject_setField_double(JavaEnv env, JavaRef obj,
size_t index, JavaDouble value);
/*
* Function: JavaObject_setFieldByName_boolean
* JavaObject_setFieldByName_byte
* JavaObject_setFieldByName_char
* JavaObject_setFieldByName_short
* JavaObject_setFieldByName_int
* JavaObject_setFieldByName_long
* JavaObject_setFieldByName_float
* JavaObject_setFieldByName_double
*
* Description:
* Sets a field of an object by name.
*
* Parameters:
* env : The execution environment.
*
* obj : The object whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the object.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaObject_setFieldByName_boolean(JavaEnv env, JavaRef obj,
char *fieldName, JavaBoolean value);
JavaStatus
JavaObject_setFieldByName_byte(JavaEnv env, JavaRef obj,
char *fieldName, JavaByte value);
JavaStatus
JavaObject_setFieldByName_char(JavaEnv env, JavaRef obj,
char *fieldName, JavaChar value);
JavaStatus
JavaObject_setFieldByName_short(JavaEnv env, JavaRef obj,
char *fieldName, JavaShort value);
JavaStatus
JavaObject_setFieldByName_int(JavaEnv env, JavaRef obj,
char *fieldName, JavaInt value);
JavaStatus
JavaObject_setFieldByName_long(JavaEnv env, JavaRef obj,
char *fieldName, JavaLong value);
JavaStatus
JavaObject_setFieldByName_float(JavaEnv env, JavaRef obj,
char *fieldName, JavaFloat value);
JavaStatus
JavaObject_setFieldByName_double(JavaEnv env, JavaRef obj,
char *fieldName, JavaDouble value);
/*
* Function: JavaObject_call
*
* Description:
* Invokes a (dynamic) method on a Java object.
* The method is looked up in the context of the
* object's class according to the specified name
* and signature.
*
* Parameters:
* env : The execution environment.
*
* result : § Any result value that the method
* returned. If the method has a void
* result type, NULL will be returned.
* Specifying a NULL pointer indicates
* that the result is not desired.
*
* obj : The object to invoke the method against.
* This object becomes the 'this' parameter
* of the method.
*
* methodName : The name of the method to invoke.
*
* methodSig : The signature of the method to invoke.
* The signature is used to determine the
* number and type of any optional parameters
* which follow it.
*
* ... : Any other parameters to be passed to the
* method according to its signature.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaObject_call(JavaEnv env, void *result,
JavaRef obj, char *methodName, char *methodSig, ...);
JavaStatus
JavaObject_vcall(JavaEnv env, void *result,
JavaRef obj, char *methodName, char *methodSig, va_list args);
/*
* Function: JavaObject_callStatic
*
* Description:
* Invokes a static method on a Java object.
* The method is looked up in the context of the
* class according to the specified name and
* signature.
*
* Parameters:
* env : The execution environment.
*
* result : § Any result value that the method
* returned. If the method has a void
* result type, NULL will be returned.
* Specifying a NULL pointer indicates
* that the result is not desired.
*
* classRef : The class object which defines the
* static method. Class objects may be
* obtained by the JavaRuntime_findClass()
* operation.
*
* methodName : The name of the method to invoke.
*
* methodSig : The signature of the method to invoke.
* The signature is used to determine the
* number and type of any optional parameters
* which follow it.
*
* ... : Any other parameters to be passed to the
* method according to its signature.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaObject_callStatic(JavaEnv env, void *result,
JavaRef classRef, char *methodName, char *methodSig, ...);
JavaStatus
JavaObject_vcallStatic(JavaEnv env, void *result,
JavaRef classRef, char *methodName, char *methodSig, va_list args);
JavaStatus
JavaObject_callStaticUTF(JavaEnv env, void *result,
char *className, char *methodName, char *methodSig, ...);
JavaStatus
JavaObject_vcallStaticUTF(JavaEnv env, void *result,
char *className, char *methodName, char *methodSig, va_list args);
/*
* Function: JavaObject_fork
* JavaObject_forkUTF
*
* Description:
* Invokes 'main' on a Java class in a new
* thread.
*
* Parameters:
* env : The execution environment.
*
* result : § Any result value that the method
* returned. If the method has a void
* result type, NULL will be returned.
* Specifying a NULL pointer indicates
* that the result is not desired.
*
* classRef : The class object which defines the
* static method. Class objects may be
* obtained by the JavaRuntime_findClass()
* operation.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The desired method was not found in the class.
* JavaStatusTypeError : Some parameter was not the appropriate type
* according to the method's signature.
* JavaStatusExceptionThrow : An exception was thrown by Java. The
* exception can be obtaind by calling
* JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaObject_fork(JavaEnv env, JavaRef *result,
JavaRef classRef, size_t argc, char **argv);
JavaStatus
JavaObject_forkUTF(JavaEnv env, JavaRef *result,
char *className, size_t argc, char **argv);
/*
* Function: JavaObject_hashCode
*
* Description:
* Returns the hash code for an object.
*
* Parameters:
* env : The execution environment.
*
* obj : The object which a hash code should be returned.
*
* result : § The returned hash code value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaObject_hashCode(JavaEnv env, JavaRef obj, JavaInt *result);
/*
* Function: JavaObject_clone
*
* Description:
* Returns a copy of the 'obj' parameter in the 'result'.
*
* Parameters:
* env : The execution environment.
*
* obj : The object to be copied
*
* result : The new object that was created.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaObject_clone(JavaEnv env, JavaRef obj, JavaRef *result);
/*
* Function: JavaObject_notify
*
* Description:
* Notifies the runtime that a resource has been unlocked.
* This will wake up the next thread blocked on the object.
*
* Parameters:
* env : The execution environment.
*
* obj : The object which one or many threads are blocked on.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaObject_notify(JavaEnv env, JavaRef obj);
/*
* Function: JavaObject_notifyAll
*
* Description:
* Wakes up all threads blocked on the object pointed to in 'obj'.
*
* Parameters:
* env : The execution environment.
*
* obj : The object on which one or many threads are blocked.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaObject_notifyAll(JavaEnv env, JavaRef obj);
/*
* Function: JavaObject_wait
*
* Description:
* Causes the current thread to block on access to an object.
*
* Parameters:
* env : The execution environment.
*
* obj : The object on which the thread is waiting for access.
*
* timeout : Max num of milliseconds we want to wait.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaObject_wait(JavaEnv env, JavaRef obj, JavaLong delay);
/*
* Function: JavaClass_getName
*
* Description:
* Get the name of the current class. Returns a C string.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class to get the name for.
*
* className : § The class name. Copy this name if you
* want to use it for anything except a quick
* string compare. The class can be unloaded
* and moved around at any given time.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
*/
JavaStatus
JavaClass_getName(JavaEnv env, JavaRef classRef, char **className);
/*
* Function: JavaClass_verify
*
* Description:
* Verifies that a class objct does not violate the
* access restrictions of other classes it references.
* It is recommended that this operation be invoked
* after loading a class from an untrusted source.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class to verify.
*
* Return status:
* JavaTrue : The class was verified to be a valid class.
* JavaFalse : The class failed to be verified.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a valid
* class object.
*/
JavaStatus
JavaClass_verify(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getSuperclass
*
* Description:
* Returns the direct superclass of a class. If the class
* Object is passed or an instance which is not a class,
* JavaNull is returned.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose superclass is required. An
* actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* Return value:
* [reference] : The super class of the specified class.
* JavaNull : The class Object was passed or an instance
* which is not a class.
*/
JavaRef
JavaClass_getSuperclass(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getClassLoader
*
* Description:
* Returns a reference to the class loader that created
* this class. JavaNull is returned for system classes.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose class loader is required. An
* actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* Return value:
* [reference] : The class loader of the specified class.
* JavaNull : The class Object was a system class.
*/
JavaRef
JavaClass_getClassLoader(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getInterfaceCount
*
* Description:
* Returns the number of interfaces of the class.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose interfaces are required. An
* actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* Return value:
* [size_t] : The number of interfaces of the class. If
* the class parameter did not specify a valid
* class, 0 is returned.
*/
size_t
JavaClass_getInterfaceCount(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getInterface
*
* Description:
* Returns the indexed interface of the class.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose interface is required. An
* actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* interfaceIndex : The index of the interface to return.
*
* interface : § The returned interface reference.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The interface with the specified index was
* not found in the class.
*/
JavaStatus
JavaClass_getInterface(JavaEnv env, JavaRef classRef,
size_t interfaceIndex, JavaRef *interface);
/*
* Function: JavaClass_implementsInterface
*
* Description:
* Determines whether a class implements an interface.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class object which is to be tested to
* determine whether it implements the interface.
* An actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* interface : The interface object to test.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a class
* object.
*/
JavaStatus
JavaClass_implementsInterface(JavaEnv env, JavaRef classRef, JavaRef interface);
/*
* Function: JavaClass_isInterface
*
* Description:
* Determines whether a class is an interface.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class object which is to be tested to
* determine whether it implements the interface.
* An actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* Return value:
* JavaTrue : The class is an interface.
* JavaFalse : The class is not an interface.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a valid
* class object.
*/
JavaStatus
JavaClass_isInterface(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getFieldInfoByName
*
* Description:
* Returns the index, signature, and access flags of a
* named field.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class of the objects whose field is to
* be accessed.
*
* field : The identifier specifying the name of the
* field.
*
* index : § The returned index of the field. Specifying
* a NULL pointer indicates that the result is
* not desired.
*
* signature : § The returned signature of the field.
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* access : § The returned access permission flag of the
* field, e.g. whether it was public, private,
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a class
* object.
*/
JavaStatus
JavaClass_getFieldInfoByName(JavaEnv env, JavaRef classRef,
char *field, size_t *index, char **signature,
JavaAccessFlags *access);
/*
* Function: JavaClass_getFieldCount
*
* Description:
* Returns the number of fields defined directly by a
* class. This does not include any fields defined by
* its superclasses.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose interfaces are required. An
* actual reference to a class object may be
* passed, or one of the special JavaRefConstant
* values.
*
* Return value:
* [size_t] : The number of fields defined directly by the
* class. If the class parameter did not specify
* a valid class, 0 is returned.
*/
size_t
JavaClass_getFieldCount(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getFieldInfo
*
* Description:
* Returns the name, signature, and access flags of a field
* specified by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class of the objects whose field is to
* be accessed.
*
* index : The index of the field in the object.
*
* name : § The resulting identifier specifying the
* name of the field. Specifying a NULL pointer
* indicates that the rsult is not desired.
*
* signature : § The returned signature of the field.
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* access : § The returned access permission flag of the
* field, e.g. whether it was public, private,
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a class
* object.
*/
JavaStatus
JavaClass_getFieldInfo(JavaEnv env, JavaRef classRef,size_t index,
char **name, char **signature, JavaAccessFlags *access);
/*
* Function: JavaClass_getMethodCount
*
* Description:
* Returns the number of methods directly defined by a
* class .This does not include any methods defined by its
* superclasses, but does include both static and dynamic
* methods.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class object.
*
* Return value:
* [size_t] : The number of methods defined directly by the
* class. If the class parameter did not specify
* a valid class, 0 is returned.
*/
size_t
JavaClass_getMethodCount(JavaEnv env, JavaRef classRef);
/*
* Function: JavaClass_getMethodInfo
*
* Description:
* Returns the name, signature, and access flags of a method
* specified by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class of the objects whose method is to
* be accessed.
*
* index : The index of the method in the object.
*
* name : § The resulting identifier specifying the
* name of the method. Specifying a NULL pointer
* indicates that the rsult is not desired.
*
* signature : § The returned signature of the method.
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* access : § The returned access permission flag of the
* method, e.g. whether it was public, private,
* Specifying a NULL pointer indicates that
* the result is not desired.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The class parameter did not specify a class
* object.
*/
JavaStatus
JavaClass_getMethodInfo(JavaEnv env, JavaRef classRef,size_t index,
char **name, char **signature, JavaAccessFlags *access);
/*
* Function: JavaClass_getFieldByName
*
* Description:
* Accesses a field of a class using an UTF string
* for the field's name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* fieldName : A NULL-terminated UTF string specifying
* the name of the field.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
*/
JavaStatus
JavaClass_getFieldByName(JavaEnv env, JavaRef classRef,
char *fieldName, JavaRef *result);
/*
* Function: JavaClass_setFieldByName
*
* Description:
* Set a field of a class using a UTF string for
* the field's name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* fieldName : A NULL-terminated UTF string specifying
* the name of the field.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaClass_setFieldByName(JavaEnv env, JavaRef classRef,
char *fieldName, JavaRef value);
/*
* Function: JavaClass_getFieldByID
*
* Description:
* Accesses a field of a class using an identifier
* for the field's name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* field : The identifier specifying the name of
* the field.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
*/
JavaStatus
JavaClass_getFieldByID(JavaEnv env, JavaRef obj,
JavaRef field, JavaRef *result);
/*
* Function: JavaClass_setFieldByID
*
* Description:
* Set a field of a class using an identifier for
* the field's name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* field : The identifier specifying the name of
* the field.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaClass_setFieldByID(JavaEnv env, JavaRef obj,
JavaRef field, JavaRef value);
/*
* Function: JavaClass_getField
*
* Description:
* Accesses a field of a class by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* index : The index of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
*/
JavaStatus
JavaClass_getField(JavaEnv env, JavaRef obj,
size_t index, JavaRef *result);
/*
* Function: JavaClass_setField
*
* Description:
* Sets a field of a class by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaClass_setField(JavaEnv env, JavaRef obj,
size_t index, JavaRef value);
/*
* Function: JavaClass_getField_boolean
* JavaClass_getField_byte
* JavaClass_getField_char
* JavaClass_getField_short
* JavaClass_getField_int
* JavaClass_getField_long
* JavaClass_getField_float
* JavaClass_getField_double
*
* Description:
* Accesses a field of a class by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* index : The index of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
*/
JavaStatus
JavaClass_getField_boolean(JavaEnv env, JavaRef obj,
size_t index, JavaBoolean *result);
JavaStatus
JavaClass_getField_byte(JavaEnv env, JavaRef obj,
size_t index, JavaByte *result);
JavaStatus
JavaClass_getField_char(JavaEnv env, JavaRef obj,
size_t index, JavaChar *result);
JavaStatus
JavaClass_getField_short(JavaEnv env, JavaRef obj,
size_t index, JavaShort *result);
JavaStatus
JavaClass_getField_int(JavaEnv env, JavaRef obj,
size_t index, JavaInt *result);
JavaStatus
JavaClass_getField_long(JavaEnv env, JavaRef obj,
size_t index, JavaLong *result);
JavaStatus
JavaClass_getField_float(JavaEnv env, JavaRef obj,
size_t index, JavaFloat *result);
JavaStatus
JavaClass_getField_double(JavaEnv env, JavaRef obj,
size_t index, JavaDouble *result);
/*
* Function: JavaClass_getFieldByName_boolean
* JavaClass_getFieldByName_byte
* JavaClass_getFieldByName_char
* JavaClass_getFieldByName_short
* JavaClass_getFieldByName_int
* JavaClass_getFieldByName_long
* JavaClass_getFieldByName_float
* JavaClass_getFieldByName_double
*
* Description:
* Accesses a field of a class by name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* fieldName : The name of the field to access.
*
* result : § The returned field value.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The field was not of appropriate type.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
*/
JavaStatus
JavaClass_getFieldByName_boolean(JavaEnv env, JavaRef obj,
char *fieldName, JavaBoolean *result);
JavaStatus
JavaClass_getFieldByName_byte(JavaEnv env, JavaRef obj,
char *fieldName, JavaByte *result);
JavaStatus
JavaClass_getFieldByName_char(JavaEnv env, JavaRef obj,
char *fieldName, JavaChar *result);
JavaStatus
JavaClass_getFieldByName_short(JavaEnv env, JavaRef obj,
char *fieldName, JavaShort *result);
JavaStatus
JavaClass_getFieldByName_int(JavaEnv env, JavaRef obj,
char *fieldName, JavaInt *result);
JavaStatus
JavaClass_getFieldByName_long(JavaEnv env, JavaRef obj,
char *fieldName, JavaLong *result);
JavaStatus
JavaClass_getFieldByName_float(JavaEnv env, JavaRef obj,
char *fieldName, JavaFloat *result);
JavaStatus
JavaClass_getFieldByName_double(JavaEnv env, JavaRef obj,
char *fieldName, JavaDouble *result);
/*
* Function: JavaClass_setField_boolean
* JavaClass_setField_byte
* JavaClass_setField_char
* JavaClass_setField_short
* JavaClass_setField_int
* JavaClass_setField_long
* JavaClass_setField_float
* JavaClass_setField_double
*
* Description:
* Sets a field of a class by index.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaClass_setField_boolean(JavaEnv env, JavaRef obj,
size_t index, JavaBoolean value);
JavaStatus
JavaClass_setField_byte(JavaEnv env, JavaRef obj,
size_t index, JavaByte value);
JavaStatus
JavaClass_setField_char(JavaEnv env, JavaRef obj,
size_t index, JavaChar value);
JavaStatus
JavaClass_setField_short(JavaEnv env, JavaRef obj,
size_t index, JavaShort value);
JavaStatus
JavaClass_setField_int(JavaEnv env, JavaRef obj,
size_t index, JavaInt value);
JavaStatus
JavaClass_setField_long(JavaEnv env, JavaRef obj,
size_t index, JavaLong value);
JavaStatus
JavaClass_setField_float(JavaEnv env, JavaRef obj,
size_t index, JavaFloat value);
JavaStatus
JavaClass_setField_double(JavaEnv env, JavaRef obj,
size_t index, JavaDouble value);
/*
* Function: JavaClass_setFieldByName_boolean
* JavaClass_setFieldByName_byte
* JavaClass_setFieldByName_char
* JavaClass_setFieldByName_short
* JavaClass_setFieldByName_int
* JavaClass_setFieldByName_long
* JavaClass_setFieldByName_float
* JavaClass_setFieldByName_double
*
* Description:
* Sets a field of a class by name.
*
* Parameters:
* env : The execution environment.
*
* classRef : The class whose field to be accessed.
*
* index : The index of the field to access.
*
* value : The new value to store in the field.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusNotFound : The field with the specified name was not
* found in the class.
* JavaStatusTypeError : The value was not the appropriate type
* for the field and consequently was not set.
*/
JavaStatus
JavaClass_setFieldByName_boolean(JavaEnv env, JavaRef obj,
char *fieldName, JavaBoolean value);
JavaStatus
JavaClass_setFieldByName_byte(JavaEnv env, JavaRef obj,
char *fieldName, JavaByte value);
JavaStatus
JavaClass_setFieldByName_char(JavaEnv env, JavaRef obj,
char *fieldName, JavaChar value);
JavaStatus
JavaClass_setFieldByName_short(JavaEnv env, JavaRef obj,
char *fieldName, JavaShort value);
JavaStatus
JavaClass_setFieldByName_int(JavaEnv env, JavaRef obj,
char *fieldName, JavaInt value);
JavaStatus
JavaClass_setFieldByName_long(JavaEnv env, JavaRef obj,
char *fieldName, JavaLong value);
JavaStatus
JavaClass_setFieldByName_float(JavaEnv env, JavaRef obj,
char *fieldName, JavaFloat value);
JavaStatus
JavaClass_setFieldByName_double(JavaEnv env, JavaRef obj,
char *fieldName, JavaDouble value);
/*
* Function: JavaIdent_make
*
* Description:
* Constructs a new identifier.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed identifier.
*
* name : The identifier's name. The name must
* be a String object.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrow : An exception was thrown by Java.
* The exception can be obtained by
* calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaIdent_make(JavaEnv env, JavaRef *result, JavaRef name);
/*
* Function: JavaIdent_getName
*
* Description:
* Gets the name of an identifier.
*
* Parameters:
* env : The execution environment.
*
* id : The Java Identifier whose name is to
* be returned.
*
* result : § The resulting name String object.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not an Identifier object.
*/
JavaStatus
JavaIdent_getName(JavaEnv env, JavaRef id, JavaRef *result);
/*
* Function: JavaString_make
*
* Description:
* Constructs a new Java String object from an array
* of Unicode characters.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed String.
*
* bytes : The array of Unicode characters. This
* array need not be null-terminated.
*
* length : The count of characters in the array.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrow : An exception was thrown by Java.
* The exception can be obtained by
* calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaString_make(JavaEnv env, JavaRef *result,
JavaChar *bytes, size_t length);
/*
* Function: JavaString_length
*
* Description:
* Returns the length of a String.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* result : § The resulting length.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_length(JavaEnv env, JavaRef string, size_t *result);
/*
* Function: JavaString_getChars
*
* Description:
* Gets a range of Unicode characters from a String.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* offset : The start offset of the range.
*
* length : The length of the range. If the length
* is -1, the range up to the end of the
* string is returned.
*
* resultBuffer : § A buffer whose contents will be set
* to the desired range of characters. The
* result buffer must be long enough to
* contain the length requested.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_getChars(JavaEnv env, JavaRef string, size_t offset,
long length, JavaChar *resultBuffer);
/*
* Function: JavaString_setChars
*
* Description:
* Sets a range of Unicode characters in a String.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* offset : The start offset of the range.
*
* length : The length of the range. If the length
* is -1, the range up to the end of the
* string is set.
*
* buffer : § A buffer whose contents will be copied
* to the desired range of characters. The
* buffer must be at least as long as the
* requested length to set.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_setChars(JavaEnv env, JavaRef string, size_t offset,
long length, JavaChar *buffer);
/*
* Function: JavaString_makeUTF
*
* Description:
* Constructs a new Java String object from a UTF
* character array.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed String.
*
* bytes : The array of UTF characters. This
* array need not be null-terminated.
*
* length : The count of characters in the array.
* If the length is specified as -1, the
* bytes are assumed to be null terminated.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrow : An exception was thrown by Java.
* The exception can be obtained by
* calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaString_makeUTF(JavaEnv env, JavaRef *result,
char *bytes, size_t length);
/*
* Function: JavaString_UTFLength
*
* Description:
* Returns the length of the UTF character array of a
* string. Since UTF is a multi-byte representation, the
* UTF length will not necessarily be the same as the
* number of characters in the string, returned by the
* JavaString_length() operation.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* result : § The resulting length.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_UTFLength(JavaEnv env, JavaRef string, size_t *result);
/*
* Function: JavaString_getUTFChars
*
* Description:
* Returns a range of characters as a UTF character array.
* The offset and length specify the position in terms of
* characters, not UTF bytes.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* offset : The start offset of the range.
*
* length : The length of the range. If the length
* is -1, the range up to the end of the
* string is returned.
*
* resultBuffer : § A buffer whose contents will be set
* to the desired range of characters. The
* result buffer must be long enough to
* contain the length requested.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_getUTFChars(JavaEnv env, JavaRef string, size_t offset,
long length, char *resultBuffer);
/*
* Function: JavaString_getStr255
*
* Description:
* Returns a range of characters as a UTF character array.
* The offset and length specify the position in terms of
* characters, not UTF bytes.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* resultBuffer : § A buffer whose contents will be set
* to the desired range of characters. The
* result buffer must be long enough to
* contain the length requested.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_getStr255(JavaEnv env, JavaRef string, UInt8 *resultBuffer);
/*
* Function: JavaString_getHandle
*
* Description:
* Takes a Java string and returns a handle to a C string.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* resultHandle : § .
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_getHandle(JavaEnv env, JavaRef string,
size_t offset, long length, Handle *resultHandle);
/*
* Function: JavaString_setUTFChars
*
* Description:
* Sets a range of characters as a UTF character array.
* The offset and length specify the position in terms
* of characters, not UTF bytes.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* offset : The start offset of the range.
*
* length : The length of the range. If the length
* is -1, the range up to the end of the
* string is set.
*
* buffer : § A buffer whose contents will be copied
* to the desired range of characters. The
* buffer must be at least as long as the
* requested length to set.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaString_setUTFChars(JavaEnv env, JavaRef string, size_t offset,
long length, char *buffer);
/*
* Function: JavaString_makeStr255
*
* Description:
* Constructs a new Java String object from a pascal
* style character array.
*
* Parameters:
* env : The execution environment.
*
* result : § The newly constructed String.
*
* theStr : The array of pascal characters.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrow : An exception was thrown by Java.
* The exception can be obtained by
* calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaString_makeStr255(JavaEnv env, JavaRef *result, ConstStr255Param theStr);
/*
* Function: JavaArray_length
*
* Description:
* Returns the length of the specified array.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* result : § The resulting length.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not a String object.
*/
JavaStatus
JavaArray_length(JavaEnv env, JavaRef array, size_t *result);
/*
* Function: JavaArray_getElement
*
* Description:
* Get the element at the specified index.
*
* Parameters:
* env : The execution environment.
*
* array : The array.
*
* index : Zero-based index.
*
* result : § The resulting reference.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not an array object.
*/
JavaStatus
JavaArray_getElement(JavaEnv env, JavaRef array, size_t index, JavaRef *result);
/*
* Function: JavaArray_setElement
*
* Description:
* Set the element at the specified index to the
* specified object.
*
* Parameters:
* env : The execution environment.
*
* array : The array.
*
* index : Zero-based index.
*
* element : The element reference.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not an array object.
*/
JavaStatus
JavaArray_setElement(JavaEnv env, JavaRef array, size_t index, JavaRef element);
/*
* Function: JavaArray_elementSize
*
* Description:
* Returns the size of an element in the specified array.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* result : § The resulting size.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not an array object.
*/
JavaStatus
JavaArray_elementSize(JavaEnv env, JavaRef array, size_t *result);
/*
* Function: JavaArray_baseAddr
*
* Description:
* Returns the address of the first element in the specified array.
*
* N.B.: This routine should only be used for direct copy
* operations. Note that the VM reserves the right to
* move object, arrays, and classes in memory at ANY
* moment. This is especially true in preemptive
* systems. Make sure all your references to objects
* etc are indirect through JavaRef.
*
* Parameters:
* env : The execution environment.
*
* string : The string.
*
* result : § The resulting pointer.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : Some parameter was not a valid reference.
* JavaStatusTypeError : The object was not an array object.
*/
JavaStatus
JavaArray_baseAddr(JavaEnv env, JavaRef array, void **result);
/*
* Function: JavaDebug_printRef
*
* Description:
*
* Parameters:
* env : The execution environment.
*
*
*/
void
JavaDebug_printRef(JavaEnv env, JavaRef ref);
/*
* Function: JavaDebug_dumpMonitors
*
* Description:
*
* Parameters:
* runtime : The runtime instance.
*
*
*/
void
JavaDebug_dumpMonitors(JavaRuntime runtime);
/*
* Function: JavaDebug_dumpThreads
*
* Description:
*
* Parameters:
* runtime : The runtime instance.
*
*
*/
void
JavaDebug_dumpThreads(JavaRuntime runtime);
/*
* Function: JavaDebug_log
*
* Description:
* Appends a printf-style string to a file named "sys_log"
* that is created and/or located in the home directory of the
* running applet or application.
*
* Parameters:
* runtime : The execution environment.
*
*
*/
void
JavaDebug_log(char *fmt, ...);
/*
* Function: JavaDebug_printFrameStack
*
* Description:
* Prints out a stack trace.
*
* Parameters:
* runtime : The execution environment.
*
*
*/
void
JavaDebug_printFrameStack(JavaEnv env);
/*
* Function: JavaDebug_setStartupClass
*
* Description:
* Given a classname and method, the runtime sets a flag to make
* that method the "main" routine of the application.
*
* Parameters:
* runtime : The execution environment.
*
*
*/
JavaStatus
JavaDebug_setStartupClass(JavaRuntime runtime,
char *className, char *methodName, char *methodSignature);
/*
* Function: JavaMemory_Allocate
*
* Description:
* Allocates memory from the Java heap.
*
* Parameters:
* env : The execution environment.
*
*
*/
void *
JavaMemory_Allocate(JavaEnv env, size_t numBytes);
/*
* Function: JavaMemory_Free
*
* Description:
* Frees memory to the Java heap space.
*
* Parameters:
* env : The execution environment.
*
*
*/
void
JavaMemory_Free(JavaEnv env, void *ptr);
/*
* Function: JavaThread_currentEnv
*
* Description:
* Returns the JavaEnv from the current thread.
*
* Parameters:
*
* Return value:
*/
JavaEnv
JavaThread_currentEnv(void);
/*
* Function: JavaThread_sleep
*
* Description:
* Puts the current thread to sleep.
*
* Parameters:
* sleep : Number of ticks for the thread to sleep.
*
* Return value:
*/
void
JavaThread_sleep(JavaLong sleep);
/*
* Function: JavaThread_yield
*
* Description:
* Yields execution to the thread scheduler.
*
* Parameters:
*
* Return value:
*/
void
JavaThread_yield(void);
/*
* Function: JavaClass_compile
*
* Description:
* Compiles the source of a class definition into a class object.
*
* Parameters:
* env : The execution environment.
*
* classDef : The source of the class to be compiled. The
* definition is specified as a UTF string.
*
* classDefLen : The length in bytes of the classDef parameter.
*
* resultingClass : § The resulting class object.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrown: An exception was thrown by the Java. The exception
* can be obtained by calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaClass_compile(JavaEnv env, char *classDef,
size_t classDefLen, JavaRef *resultingClass);
/*
* Function: JavaExpr_compile
*
* Description:
* Compiles the source of an expression into an object which may
* be evaluated.
*
* Parameters:
* env : The execution environment.
*
* expr : The source of the Java expression to be compiled. The
* definition is specified as a UTF string.
*
* exprLen : The length in bytes of the expr parameter.
*
* resultingExpr : § The resulting compiled expression object.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrown: An exception was thrown by the Java. The exception
* can be obtained by calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaExpr_compile(JavaEnv env, char *expr,
size_t exprLen, JavaRef *resultingExpr);
/*
* Function: JavaExpr_eval
*
* Description:
* Evaulates an expression object.
*
* Parameters:
* env : The execution environment.
*
* exprRef : The Java expression to be evaluated.
*
* result : § The resulting value of the expression. Specifying.
* a NULL pointer indicates that the result is not desired.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrown: An exception was thrown by the Java. The exception
* can be obtained by calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaExpr_eval(JavaEnv env, JavaRef expr, JavaRef *result);
/*
* Function: JavaEnv_getFrameCount
*
* Description:
* Returns the number of currently active stack frames in an
* environment. A stack frame to associated with each pending
* method invocation.
*
* Parameters:
* env : The execution environment.
*
* Return value:
* The resulting count of the number of frames.
*/
size_t
JavaEnv_getFrameCount(JavaEnv env);
/*
* Function: JavaEnv_getFrameInfo
*
* Description:
* Returns information about a particular stack frame. Stack
* frames are referenced by index, the oldest being at index 0,
* and the current at JavaEnv_getFrameCount() - 1.
*
* Parameters:
* env : The execution environment.
*
* frameIndex : The index of the frame for which information is
* desired. Specifying a frame index of -1 is equivalent
* to the current frame.
*
* methodClass : § The resulting class which implements the method
* being invoked in the frame. Note that this may be
* different from the class of the object. Specifying a
* NULL pointer indicates that the result is not desired.
*
* methodName : § The resulting name of the method being invoked in
* the frame. Specifying a NULL pointer indicate that the
* result is not desired.
*
* methodSig : § The resulting signature of the method being invoked
* in the frame. Specifying a NULL pointer indicates that
* the result is not desired.
*
* varCount : § The resulting count of the number of local variables
* in the frame. This count includes the formal paramaters
* of the method. Specifying a NULL pointer indicates that
* the result is not desired.
*
* Return status:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The frameIndex did not specify a valid frame.
*/
JavaStatus
JavaEnv_getFrameInfo(JavaEnv env, size_t frameIndex,
JavaBoolean *isClassMonitor, JavaBoolean *isObjectMonitor,
char **methodClass, char **methodName, char **methodSig, size_t *varCount);
/*
* Function: JavaEnv_getVarInfo
*
* Description:
* Returns the name and signature of a local variable if debugging
* information is available.
*
* Parameters:
* env : The execution environment.
*
* frameIndex : The index of the frame for which information is
* desired. Specifying a frame index of -1 is equivalent
* to the current frame.
*
* varIndex : The index of the local variable for which the value
* is desired.
*
* name : § The resulting name of the local variable. The name
* is returned as an identifier. Specifying a NULL pointer
* indicates that the result is not desired.
*
* signature : § The resulting signature of the local variable. The
* signature is returned as an identifier. Specifying a
* NULL poiner indicates that the result is not desired.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The frameIndex did not specify a valid frame or the
* varIndex did not specify a valid local variable index.
* JavaStatusNotFound : The name and the signature were not available because
* no debugging information was available.
*/
JavaStatus
JavaEnv_getVarInfo(JavaEnv env, size_t frameIndex,
size_t varIndex, char **name, char **signature);
/*
* Function: JavaEnv_getVarValue
*
* Description:
* Returns the name and signature of a local variable if debugging
* information is available.
*
* Parameters:
* env : The execution environment.
*
* frameIndex : The index of the frame for which information is
* desired. Specifying a frame index of -1 is equivalent
* to the current frame.
*
* varIndex : The index of the local variable for which the value
* is desired.
*
* buffer : § .
*
* bufferLength : § .
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The frameIndex did not specify a valid frame or the
* varIndex did not specify a valid local variable index.
* JavaStatusNotFound : The name and the signature were not available because
* no debugging information was available.
*/
JavaStatus
JavaEnv_getVarValue(JavaEnv env, size_t frameIndex,
size_t varIndex, char *buffer, size_t bufferLength);
/*
* Function: JavaEnv_getSourceInfo
*
* Description:
* Returns the source file name and line number corresponding to
* the current instruction being executed if debugging information
* is available.
*
* Parameters:
* env : The execution environment.
*
* frameIndex : The index of the frame for which information is
* desired. Specifying a frame index of -1 is equivalent
* to the current frame.
*
* filename : § The resulting filename from which the method associated
* with the specified frame was compiled. Specifying a NULL
* pointer indicates that the result is not desired.
*
* lineNumber : § The resulting line number in the file. Specifying a
* NULL pointer indicates that the result is not desired.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The frameIndex did not specify a valid frame.
* JavaStatusNotFound : The source information was not available because no
* debugging information was available.
*/
JavaStatus
JavaEnv_getSourceInfo(JavaEnv env,
size_t frameIndex, char **filename, size_t *lineNumber);
/*
* Function: JavaEnv_getBytecodeInfo
*
* Description:
* Returns the source file name and line number corresponding to
* the current instruction being executed if debugging information
* is available.
*
* Parameters:
* env : The execution environment.
*
* frameIndex : The index of the frame for which information is
* desired. Specifying a frame index of -1 is equivalent
* to the current frame.
*
* className : § .
*
* methodIndex : § .
*
* methodOffset : § .
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusParamError : The frameIndex did not specify a valid frame.
* JavaStatusNotFound : The source information was not available because no
* debugging information was available.
*/
JavaStatus
JavaEnv_getBytecodeInfo(JavaEnv env,
size_t frameIndex, char **className, size_t *methodIndex, size_t *methodOffset);
/*
* Function: JavaRuntime_profileDump
*
* Description:
* Dumps profile information to a file.
*
* Parameters:
* env : The execution environment.
*
* Return value:
* JavaStatusOk : Operation completed normally.
* JavaStatusExceptionThrown: An exception was thrown by the Java. The exception
* can be obtained by calling JavaEnv_exceptionOccurred().
*/
JavaStatus
JavaRuntime_profileDump(JavaRuntime runtime, char *filename);
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif __RoasterVM__